/**
  ETFAna project, Anyang Normal University && IMP-CAS
  \class ETFTask
  \brief abstract base class for generic tasks in ETFAna
  \author SUN Yazhou, asia.rabbit@163.com
  \since 2023-07-01
  \date 2024-06-19 last modified
  \attention
  changelog
  <table>
  <tr>  <th>Date         <th>Author      <th>Description                   </tr>
  <tr>  <td>2023-07-01   <td>Asia Sun    <td>file created                  </tr>
  </table>

  \copyright Copyright (c) 2021-2024 Anyang Normal U. && IMP-CAS with LGPLv3 LICENSE
*/

#ifndef ETFTask_h
#define ETFTask_h

#include <vector>
#include <string>

using std::vector;
using std::string;

class TH1;
class TTree;
class TFile;
class TDirectory;
class ETFRun;
class ETFPID;
class ETFPIDm;
class ETFSource;
class ETFAnalyzer;
class ETFVMEEvent;
class ETFPXISection;
class ETFPIDManager;
class ETFParaManager;
class ETFHistManager;
class ETFTrackManager;
class ETFDetectorManager;

class ETFTask{
public:
  ETFTask(const char *name = "ETFTask");
  virtual ~ETFTask();

  virtual void Init();
  virtual void Exec() = 0;
  virtual void CreateHistos() = 0; ///< create histograms for filling
  virtual void WriteHistos();
  /// \param subdir -> TaskName/subdir
  virtual void addh(TH1 *h, const string &subdir = "");

  // ClassDef(ETFTask, 0); // abstract base class for tasks in the unpacking stage

protected:
  string fName;
  int fAnaLevel;
  vector<ETFPXISection *> fPXISections;
  vector<ETFVMEEvent *> fVMEEvents;

  TDirectory *fFolder; ///< folder to categorize the objects in this task
  TTree *fTree; ///< the main tree
  TFile *fRootFile; ///< the main output rootfile

  // the managers and the data source //
  ETFSource *fSrc; ///< the data source
  ETFRun *fRun;
  ETFParaManager *fpm;
  ETFHistManager *fhm;
  ETFDetectorManager *fdm;
  ETFTrackManager *ftm;
  ETFPIDManager *fpidm;
  ETFAnalyzer *fAnalyzer;
  ETFPID *fPID; ///< for pid of the heavy residue, i.e., the core
  ETFPIDm *fPIDm; ///< for pid of light fragments, e.g., proton, pion, deutron, etc.
};

#endif
